use chrono::Local;
use serde::{Deserialize, Serialize};
use sqlx::types::chrono::DateTime;
use struct_field_names_as_array::FieldNamesAsSlice;

// 产品分类表单数据
#[derive(sqlx::FromRow, Deserialize, Serialize, FieldNamesAsSlice)]
pub struct TaxonForm { 
    // 名称
    pub name: String, 
    // 图标
    pub image: String,
    // 排序
    pub order_by: i64
}

// 产品分类列表行数据
#[derive(sqlx::FromRow, Deserialize, Serialize, FieldNamesAsSlice)]
pub struct TaxonRow { 
    pub id: i64,
    pub name: String, 
    pub image: String,
    pub order_by: i64,
    pub num: i64,
    pub created_at: DateTime<Local>,
    pub updated_at: DateTime<Local>
}
